new Vue({
    el: "#container",
    data() {
        return {
            defaultDay: null,
            // 查询数据
            tableSearch: {
                pageIndex: 0,
                limit: 50,
                total: 0,
                dateFormat: "yyyy-MM-dd HH:mm",
                endDate: null,
                startDate: null,
                searchVal: "",
                proType: null,
            },
            //  表数据
            tableDatas: [],
            tableLoading: false,
            //  合同属性
            categoryList: null,
            roadTypeList: null,
            overLimitList: null,
            //  强度等级列表
            strengthList: [],
            //  特性要求
            techList: [],
            //  浇筑方式
            castModeList: [],
            //  泵送类型
            pumpTypeList: [],
            //  泵送规格
            pumpNormList: [],
            //  泵送设备
            pumpDeviceList: [],
            //  任务单状态
            indentTypeList: [],
            //  弹窗数据
            dialog: {
                title: "",
                show: false,
                loading: false,
                device: true,
                //  是否为更新数据
                update: false,
            },
            //  任务单表单
            indentForm: {
                id: null,
                url: "/pro/indent/add",
                //  上传的数据
                render: {
                    conId: null,
                    strengthId: null,
                    techIds: null,
                    tech: null,
                    planStere: null,
                    castModeId: null,
                    //  泵送设备
                    pumpDeviceId: null,
                    pumpDeviceIds: null,
                    pumpTypeId: null,
                    pumpNormId: null,
                    site: null,
                    slumps: "220±20",
                    //slumpsSuffix: "±20",
                    distance: null,
                    address: null,
                    roadType: 0,
                    linkMan: null,
                    linkPhone: null,
                    // builderStartTime: null,
                    dispatchStartTime: null,
                    foreman: null,
                    type: 0,
                },
                //  仅用于展示的数据
                exhibition: {
                    techItems: null,
                    conName: null,
                    //  合同类型
                    conCategory: null,
                    clientName: null,
                    sales: null,
                    castMode: null,
                    pumpDevice: null,
                },
            },
            //  任务单验证规则
            indentRules: {
                render: {
                    conId: [
                        {required: true, message: '请选择合同', trigger: 'blur'},
                    ],
                    site: [
                        {required: true, message: '请输入施工部位', trigger: 'blur'},
                    ],
                    strengthId: [
                        {required: true, message: '请选择强度', trigger: 'blur'},
                    ],
                    slumps: [
                        {required: true, message: '请输入坍落度', trigger: 'blur'},
                    ],
                    distance: [
                        {required: true, type: 'number', message: '请输入运距(只能是数字类型)', trigger: 'blur'},
                    ],
                    castModeId: [
                        {required: true, message: '请选择浇筑方式', trigger: 'blur'},
                    ],
                    roadType: [
                        {required: true, message: '请选择运输道理类型', trigger: 'blur'},
                    ],
                    /*builderStartTime: [
                        {required: true, message: '请选择施工方要求开盘时间', trigger: 'blur'},
                    ],*/
                    dispatchStartTime: [
                        {required: true, message: '请选择生产要求开盘时间', trigger: 'blur'},
                    ],
                    planStere: [
                        {required: true, type: 'number', message: '请输入计划方量(只能是数字类型)', trigger: 'blur'},
                    ],
                    type: [
                        {required: true, message: '请选择任务单供应状态', trigger: 'blur'},
                    ]
                }
            },
            //  是否显示弹窗
            conPopover: false,
            dialogSearch: {
                searchVal: null,
                loading: false,
            },
            //  合同数据
            conList: [],
        }
    },
    // 在模板渲染成html前调用
    created() {
        var that = this;
        let currentDate = new Date();
        /*let defaultDay = currentDate.setDate(currentDate.getDate() + 1);
        defaultDay = new Date(defaultDay);
        defaultDay = getFormatDate(defaultDay, "yyyy-MM-dd HH:mm");
        that.defaultDay = defaultDay;
        that.indentForm.render.builderStartTime = that.defaultDay;*/
        that.loadTableDatas();
        that.searchCon();
        that.loadCastModeList();
        //  加载泵送设备
        that.loadPumpDeviceList();
    },
    // 在模板渲染成html后调用，通常是初始化页面完成后，再对html的dom节点进行一些需要的操作
    mounted() {
        var that = this;
        that.categoryList = categoryList;
        that.roadTypeList = roadTypeList;
        that.overLimitList = overLimitList;
        that.indentTypeList = indentTypeList;
        that.indentForm.render.type = indentTypeList[0];
    },
    methods: {
        //  查询合同
        searchCon() {
            let that = this;
            //  搜索项目名称
            let searchVal = that.dialogSearch.searchVal;
            $.ajax({
                url: '/sale/contract/list',
                type: 'POST',
                dataType: 'json',
                timeout: 30000,
                data: {
                    searchVal: searchVal,
                    workStatus: 2,
                },
                success: function (res) {
                    if (res.code == 0) {
                        that.conList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '加载合同失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '查询合同失败',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    if (status == 'timeout') {
                        return;
                    }
                }
            })
        },
        //  加载合同的强度等级
        loadStrengthList() {
            let that = this;
            $.ajax({
                type: "POST",
                url: "/sale/contract/strength/list",
                async: true,
                dataType: 'json',
                data: {
                    conId: that.indentForm.render.conId,
                },
                success: function (res) {
                    if (res.code == 0) {
                        that.strengthList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询砼标号失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.tableLoading = false;
                }
            })
        },
        //  加载合同的特性要求
        loadTechList(fnc) {
            let that = this;
            $.ajax({
                type: "POST",
                url: "/sale/contract/tech/list",
                async: true,
                dataType: 'json',
                data: {
                    conId: that.indentForm.render.conId,
                },
                success: function (res) {
                    if (res.code == 0) {
                        that.techList = res.data;
                        if (fnc != null){
                            fnc();
                        }
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询合同特性要求失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.tableLoading = false;
                }
            })
        },
        //  加载浇筑方式
        loadCastModeList() {
            let that = this;
            $.ajax({
                type: "POST",
                url: "/cast/mode/list",
                async: true,
                dataType: 'json',
                data: {},
                success: function (res) {
                    if (res.code == 0) {
                        that.castModeList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询浇筑方式失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.tableLoading = false;
                }
            })
        },
        //  加载泵送类型
        loadPumpTypeList() {
            let that = this;
            $.ajax({
                type: "POST",
                // url: "/pump/type/list",
                url: "/sale/contract/pump/type/list",
                async: true,
                dataType: 'json',
                data: {
                    conId: that.indentForm.render.conId
                },
                success: function (res) {
                    if (res.code == 0) {
                        that.pumpTypeList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询泵送类型失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.tableLoading = false;
                }
            })
        },
        //  加载泵送规格
        loadPumpNormList() {
            let that = this;
            $.ajax({
                type: "POST",
                // url: "/pump/norm/list",
                url: "/sale/contract/pump/norm/list",
                async: true,
                dataType: 'json',
                data: {
                    conId: that.indentForm.render.conId
                },
                success: function (res) {
                    if (res.code == 0) {
                        that.pumpNormList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询泵送规格失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.tableLoading = false;
                }
            })
        },
        //  加载泵送设备
        //  查询全部的泵送设备,仅选择该合同下的泵送类型和规格
        loadPumpDeviceList() {
            let that = this;
            $.ajax({
                type: "POST",
                // url: "/sale/contract/pump/device/list",
                url: "/pump/device/org/list",
                async: true,
                dataType: 'json',
                data: {
                    conId: that.indentForm.render.conId
                },
                success: function (res) {
                    if (res.code == 0) {
                        that.pumpDeviceList = res.data;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询泵送设备失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.tableLoading = false;
                }
            })
        },
        searchDatas() {
            let that = this;
            that.tableSearch.pageIndex = 0;
            that.tableSearch.limit = 50;
            that.loadTableDatas();
        },
        // 加载数据
        loadTableDatas: function () {
            let that = this;
            that.tableLoading = true;
            $.ajax({
                type: "POST",
                url: "/pro/indent/page",
                async: true,
                dataType: 'json',
                data: that.tableSearch,
                success: function (res) {
                    if (res.code == 0) {
                        let page = res.data;
                        that.tableDatas = page.records;
                        that.tableSearch.total = page.total;
                    } else {
                        that.$message({
                            showClose: true,
                            message: '查询任务单失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.tableLoading = false;
                }
            })
        },
        //  显示任务单弹窗
        showAddDialog() {
            let that = this;
            that.dialog.device = true;
            that.dialog.show = true;
            that.indentForm.render.type = 0;
            that.indentForm.url = "/pro/indent/add";
            that.dialog.update = false;
            setTimeout(function () {
                that.$refs["indentForm"].clearValidate();
            }, 100)
        },
        //  合同变更
        conChange(item) {
            let that = this;
            //  清空合同关联信息
            that.indentForm.render.strengthId = null;
            that.indentForm.render.pumpDeviceIds = null;
            if (item == null) {
                that.indentForm.render.conId = null;
                that.indentForm.exhibition.conCategory = null;
                that.indentForm.exhibition.clientName = null;
                that.indentForm.exhibition.sales = null;
                that.indentForm.exhibition.conName = null;
                that.indentForm.render.foreman = null;
                that.indentForm.render.address = null;
                that.indentForm.render.distance = null;
            } else {
                let category = item.contractCategory;
                let conCategory = "";
                $.each(categoryList, function (i, o) {
                    if (o.code == category) {
                        conCategory = o.desc;
                    }
                })
                that.indentForm.render.conId = item.id;
                that.indentForm.render.foreman = item.foreman;
                that.indentForm.render.address = item.address;
                that.indentForm.render.distance = item.distance;
                that.indentForm.exhibition.conCategory = conCategory;
                that.indentForm.exhibition.clientName = item.clientName;
                that.indentForm.exhibition.sales = item.sales;
                that.indentForm.exhibition.conName = item.name;
                that.conPopover = false;
                // that.$refs("indentForm").clearValidate();
                //  加载强度等级
                that.loadStrengthList();
                that.loadTechList(null);
                that.loadPumpTypeList();
                that.loadPumpNormList();
            }
        },
        //  浇筑方式变化
        castModeChange(castMode) {
            let that = this;
            that.indentForm.render.pumpDeviceIds = null;
            that.indentForm.render.pumpTypeId = null;
            that.indentForm.render.pumpNormId = null;
            if (isNull(castMode)) {
                that.indentForm.render.castModeId = null;
                that.dialog.device = null;
            } else {
                that.indentForm.render.castModeId = castMode.id;
                let device = castMode.cost;
                if (!isNull(device) && device == 1) {
                    //  需要派遣设备
                    that.dialog.device = false;
                } else {
                    //  不需要派遣设备
                    that.dialog.device = true;
                    that.indentForm.render.pumpDeviceIds = null;
                }
            }
        },
        //  泵送设备变化
        pumpDeviceChange(pumpDevice) {
            let that = this;
            if (isNull(pumpDevice)) {
                that.indentForm.render.pumpDeviceId = null;
                that.indentForm.render.pumpDeviceIds = null;
                that.indentForm.render.pumpTypeId = null;
                that.indentForm.render.pumpNormId = null;
            } else {
                let pumpTypeId = pumpDevice.pumpTypeId;
                let pumpNormId = pumpDevice.pumpNormId;
                /*if(that.indentForm.render.pumpDeviceIds == null){
                    that.indentForm.render.pumpDeviceIdss = [];
                }
                that.indentForm.render.pumpDeviceIds.push(pumpDevice.id);*/
                that.indentForm.render.pumpDeviceId = pumpDevice.id;
                that.indentForm.render.pumpTypeId = pumpTypeId;
                that.indentForm.render.pumpNormId = pumpNormId;
            }
        },
        onSubmit(formName) {
            let that = this;
            that.$refs[formName].validate((valid, error) => {
                if (valid) {
                    //  验证计划方量
                    let planStere = that.indentForm.render.planStere;
                    if (planStere <= 0) {
                        that.$message({
                            showClose: true,
                            message: '请输入大于0的计划方量',
                            type: 'error'
                        });
                        return;
                    }
                    //  设置泵送设备列表
                    let pumpDeviceIds = [];
                    let pumpDeviceId = that.indentForm.render.pumpDeviceId;
                    if (pumpDeviceId != null && pumpDeviceId != undefined) {
                        pumpDeviceIds.push(pumpDeviceId);
                    }
                    that.indentForm.render.pumpDeviceIds = pumpDeviceIds;
                    that.dialog.loading = true;
                    let techItems = that.indentForm.exhibition.techItems;
                    if (techItems != null) {
                        let techIds = [];
                        let tech = [];
                        for (let i = 0, s = techItems.length; i < s; i++) {
                            let techItem = techItems[i];
                            techIds.push(techItem.id);
                            tech.push(techItem.equirement);
                        }
                        that.indentForm.render.techId = techIds.join(",");
                        that.indentForm.render.tech = tech.join(",");
                    } else {
                        that.indentForm.render.techId = null;
                        that.indentForm.render.tech = null;
                    }
                    $.ajax({
                        type: "PUT",
                        url: that.indentForm.url,
                        async: true,
                        dataType: 'json',
                        data: that.indentForm.render,
                        success: function (res) {
                            if (res.code == 0) {
                                that.$message({
                                    showClose: true,
                                    message: '操作成功',
                                    type: 'success'
                                });
                                that.loadTableDatas();
                                that.cancel();
                            } else {
                                that.$message({
                                    showClose: true,
                                    message: '保存失败：' + res.msg,
                                    type: 'error'
                                });
                            }
                        },
                        error: function (res) {
                            that.$message({
                                showClose: true,
                                message: '请求失败，请联系管理员',
                                type: 'error'
                            });
                            return;
                        },
                        complete: function (XMLHttpRequest, status) {
                            that.dialog.loading = false;
                        }
                    })
                } else {
                    let msg = error[Object.keys(error)[0]][0].message;
                    that.$message({
                        showClose: true,
                        message: '验证表单失败:' + msg,
                        type: 'error'
                    });
                    return false;
                }
            });
        },
        //  删除任务单
        delIndent(indentId) {
            let that = this;
            that.tableLoading = true;
            $.ajax({
                type: "DELETE",
                url: "/pro/indent/delete/" + indentId,
                async: true,
                dataType: 'json',
                data: {},
                success: function (res) {
                    if (res.code == 0) {
                        that.loadTableDatas();
                    } else {
                        that.$message({
                            showClose: true,
                            message: '删除任务单失败：' + res.msg,
                            type: 'error'
                        });
                    }
                },
                error: function (res) {
                    that.$message({
                        showClose: true,
                        message: '请求失败，请联系管理员',
                        type: 'error'
                    });
                    return;
                },
                complete: function (XMLHttpRequest, status) {
                    that.tableLoading = false;
                }
            })
        },
        //  编辑任务单
        showEditDialog: function (indent) {
            let that = this;
            let indentId = indent.id;
            that.dialog.device = false;
            that.dialog.update = true;
            let pumpDeviceId = null;
            let pumpDeviceIds = indent.pumpDeviceIds;
            if (!isNull(pumpDeviceIds)) {
                pumpDeviceIds = pumpDeviceIds.split(",");
                let tIds = new Array();
                $.each(pumpDeviceIds, function (index, id) {
                    tIds.push(parseInt(id));
                });
                pumpDeviceIds = tIds;
                pumpDeviceId = tIds[0];
            }
            that.indentForm = {
                //  上传的数据
                id: indentId,
                url: "/pro/indent/update/" + indentId,
                render: {
                    conId: indent.conId,
                    strengthId: indent.strengthId,
                    techId: indent.techId,
                    planStere: indent.planStere,
                    castModeId: indent.castModeId,
                    pumpDeviceId: pumpDeviceId,
                    pumpDeviceIds: pumpDeviceIds,
                    pumpTypeId: indent.pumpTypeId,
                    pumpNormId: indent.pumpNormId,
                    type: indent.type,
                    site: indent.site,
                    /*slumps: indent.slumps.split("±")[0],
                    slumpsSuffix: indent.slumps.split("±")[1],*/
                    slumps: indent.slumps,
                    distance: indent.distance,
                    address: indent.address,
                    linkMan: indent.linkMan,
                    linkPhone: indent.linkPhone,
                    // builderStartTime: indent.builderStartTime,
                    dispatchStartTime: indent.dispatchStartTime,
                    foreman: indent.foreman,
                    roadType: indent.roadType
                },
                //  仅用于展示的数据
                exhibition: {
                    //con: indent.,
                    //  合同类型
                    //conCategory: indent.,
                    castMode: indent.castModelName,
                    pumpDevice: indent.pumpDeviceName,
                    conName: indent.conName
                },
            }
            that.loadStrengthList();
            that.loadTechList(function () {
                let techIds = indent.techId;
                if (!isNull(techIds)) {
                    techIds = techIds.split(",");
                    let techItems = new Array();
                    let techList = that.techList;
                    for (let i = 0,s = techList.length;i < s;i++){
                        let ttdata = techList[i];
                        let techId = ttdata.id;
                        techId += "";
                        if (techIds.indexOf(techId) > -1){
                            techItems.push(ttdata);
                        }
                    }
                    that.indentForm.exhibition.techItems = techItems;
                }
            });
            that.loadPumpTypeList();
            that.loadPumpNormList();
            let conList = that.conList;
            let categoryList = that.categoryList;
            $.each(conList, function (i, itemCon) {
                if (indent.conId == itemCon.id) {
                    // that.indentForm.exhibition.con = itemCon;
                    let conCategory = "";
                    $.each(categoryList, function (i1, o1) {
                        if (o1.code == itemCon.contractCategory) {
                            conCategory = o1.desc;
                        }
                    })
                    that.indentForm.exhibition.conCategory = conCategory;
                    that.indentForm.exhibition.clientName = itemCon.clientName;
                    that.indentForm.exhibition.sales = itemCon.sales;
                }
            })
            that.dialog.show = true;
        },
        //  复制新增
        showCopyDialog: function (indent) {
            let that = this;
            that.dialog.device = false;
            that.dialog.update = false;
            let pumpDeviceId = null;
            let pumpDeviceIds = indent.pumpDeviceIds;
            if (!isNull(pumpDeviceIds)) {
                pumpDeviceIds = pumpDeviceIds.split(",");
                let tIds = new Array();
                $.each(pumpDeviceIds, function (index, id) {
                    tIds.push(parseInt(id));
                });
                pumpDeviceIds = tIds;
                pumpDeviceId = tIds[0];
            }
            that.indentForm = {
                //  上传的数据
                url: "/pro/indent/add",
                render: {
                    conId: indent.conId,
                    strengthId: indent.strengthId,
                    techId: indent.techId,
                    planStere: indent.planStere,
                    castModeId: indent.castModeId,
                    pumpDeviceId: pumpDeviceId,
                    pumpDeviceIds: pumpDeviceIds,
                    pumpTypeId: indent.pumpTypeId,
                    pumpNormId: indent.pumpNormId,
                    type: 0,
                    site: null,
                    /*slumps: indent.slumps.split("±")[0],
                    slumpsSuffix: indent.slumps.split("±")[1],*/
                    slumps: indent.slumps,
                    distance: indent.distance,
                    address: indent.address,
                    roadType: indent.roadType,
                    linkMan: indent.linkMan,
                    linkPhone: indent.linkPhone,
                    // builderStartTime: indent.builderStartTime,
                    dispatchStartTime: indent.dispatchStartTime,
                    foreman: indent.foreman,
                },
                //  仅用于展示的数据
                exhibition: {
                    //con: indent.,
                    //  合同类型
                    //conCategory: indent.,
                    castMode: indent.castModelName,
                    pumpDevice: indent.pumpDeviceName,
                    conName: indent.conName
                },
            }
            that.loadStrengthList();
            let techIds = indent.techId;
            that.loadTechList(function () {
                let techIds = indent.techId;
                if (!isNull(techIds)) {
                    techIds = techIds.split(",");
                    let techItems = new Array();
                    let techList = that.techList;
                    for (let i = 0,s = techList.length;i < s;i++){
                        let ttdata = techList[i];
                        let techId = ttdata.id;
                        techId += "";
                        if (techIds.indexOf(techId) > -1){
                            techItems.push(ttdata);
                        }
                    }
                    that.indentForm.exhibition.techItems = techItems;
                }
            });
            let conList = that.conList;
            let categoryList = that.categoryList;
            $.each(conList, function (i, itemCon) {
                if (indent.conId == itemCon.id) {
                    // that.indentForm.exhibition.con = itemCon;
                    let conCategory = "";
                    $.each(categoryList, function (i1, o1) {
                        if (o1.code == itemCon.contractCategory) {
                            conCategory = o1.desc;
                        }
                    })
                    that.indentForm.exhibition.conCategory = conCategory;
                    that.indentForm.exhibition.clientName = itemCon.clientName;
                    that.indentForm.exhibition.sales = itemCon.sales;
                }
            })
            that.dialog.show = true;
        },
        //  选择了工地开盘时间
        chooseBuildTime(value) {
            let that = this;
            // 将日期字符串解析为 Date 对象
            const date = new Date(value);
            // 检查日期是否有效
            if (!isNaN(date.getTime())) {
                // 获取当前小时
                const currentHour = date.getHours();
                // 设置新的小时，加一个小时
                date.setHours(currentHour + 1);
                that.indentForm.render.dispatchStartTime = date;
            }
        },
        //  导出报表
        exportData() {
            let that = this;
            let startTime = that.tableSearch.startDate;
            if (startTime == null) {
                that.$message({
                    showClose: true,
                    message: '导出失败,请选择开始时间',
                    type: 'error'
                });
                return;
            }
            let endTime = that.tableSearch.endDate;
            if (endTime == null) {
                that.$message({
                    showClose: true,
                    message: '导出失败,请选择截止时间',
                    type: 'error'
                });
                return;
            }
            that.tableLoading = true;
            $.ajax({
                type: "POST", //提交方式
                url: "/pro/indent/export",//路径
                xhrFields: {responseType: "arraybuffer"},
                data: that.tableSearch,
                beforeSend: function (request) {
                    request.setRequestHeader("Authorization", "xxx");
                },
                success: function (result, textStatus, request) {
                    let responseHeader = decodeURIComponent(escape(request.getResponseHeader("Content-Disposition")));
                    let s = responseHeader.split("filename=");
                    let filename = s[1];
                    const blob = new Blob([result], {type: "application/vnd.ms-excel"});
                    if (blob.size < 1) {
                        that.$message({
                            showClose: true,
                            message: '导出失败，导出的内容为空！',
                            type: 'error'
                        });
                        return
                    }
                    if (window.navigator.msSaveOrOpenBlob) {
                        navigator.msSaveOrOpenBlob(blob, filename)
                    } else {
                        const aLink = document.createElement('a');
                        aLink.style.display = 'none';
                        aLink.href = window.URL.createObjectURL(blob);
                        aLink.download = filename;
                        document.body.appendChild(aLink);
                        aLink.click();
                        document.body.removeChild(aLink);
                    }

                },
                error: function () {

                },
                complete: function () {
                    that.tableLoading = false;
                }
            });
        },
        //  取消添加
        cancel() {
            let that = this;
            Object.keys(that.indentForm.render).forEach(key => {
                that.indentForm.render[key] = null;
            });
            that.indentForm.render.type = 0;
            that.indentForm.render.roadType = 0;
            that.indentForm.render.slumps = "220±20";
            // that.indentForm.render.builderStartTime = that.defaultDay;
            Object.keys(that.indentForm.exhibition).forEach(key => {
                that.indentForm.exhibition[key] = null;
            });
            that.dialog.show = false;
        },
        // 修改每页数据
        handleSizeChange(val) {
            var that = this;
            that.tableSearch.limit = val;
            // 查询数据
            that.loadTableDatas();
        },
        handleCurrentChange(val) {
            // 设置页数
            var that = this;
            that.tableSearch.pageIndex = val;
            that.loadTableDatas();
        },
    }
})
